package leetcode.code;

import leetcode.IDebug;
import leetcode.helper.HelpDebug;
import leetcode.helper.MaxDebug;

public class Solution383 implements IDebug {

	public boolean canConstruct(String ransomNote, String magazine) {
		int[] dic = new int[123];
		for (char c : ransomNote.toCharArray()) {
			dic[c]++;
		}
		for (char c : magazine.toCharArray()) {
			dic[c]--;
		}
		for (int num : dic) {
			if (num > 0)
				return false;
		}
		return true;
	}

	@Override
	public void debug1() {
		HelpDebug.compare(this.canConstruct("a", "b"), false);

	}

	@Override
	public void debug2() {
		HelpDebug.compare(this.canConstruct("aa", "ab"), false);

	}

	@Override
	public void debug3() {
		HelpDebug.compare(this.canConstruct("aa", "aab"), true);

	}

	@Override
	public void debug4() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		Solution383 so = new Solution383();
		MaxDebug.debug14(so);
		System.out.println((int) 'a');
		System.out.println((int) 'z');
	}

}
